# -*- coding: utf-8 -*-
# @Time: 2022/4/29 14:07
# @Author: 发抖的小喵喵
# @Email: panyi_20210601@163.com
# @File: Post.py
# @Project: haixin
# @Software: PyCharm


import requests
from test_case.haixin.getSign import GetSign
import json


def post_method(data, url):
    getSign = GetSign(data)
    ls = getSign.sign()

    headers = {
        "appId": "1a748b70d0cb4a8a8e37e959f4a4f1e6",
        "timestamp": ls[2],
        "randNum": ls[3],
        "sign": ls[0],
        "Content-Type": "application/json; charset=utf-8"
    }
    print(headers)
    req = requests.post(url, headers=headers, data=ls[1], timeout=10)  # ls[1] type:str
    res = req.json()
    return res
